home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 71 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.5 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Scope rules in new ANSI for lookup
  5. Date: 18 Jan 1996 11:08:41 PST
  6. Organization: Computer People Inc.
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <ALUN.CHAMPION.96Jan18141354@g7240065.bridge.bst.bls.com>
  9. References: <30FE0827.52A0C2CF@inetsys.alt.za>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 18 Jan 1996 19:13:54 GMT
  12. In-Reply-To: Tiaan Wessels's message of 18 Jan 1996 10:18:44 PST
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMP6a3ky4NqrwXLNJAQHP8wH/S4zSBEossf6lz7aHKyYbSu2cmY7l/ALf
  15.     bE2hdEVWH5VDy7wobfknb5YWhgJzBeQUMJ2PSRVSuHh0EHmNnU+j5A==
  16.     =IN/2
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. In article <30FE0827.52A0C2CF@inetsys.alt.za> Tiaan Wessels <tiaan@inetsys.alt.za> writes:
  20.  
  21. : Can someone please enlighten me on the new ANSI 'for' scoping's name
  22. : lookup rules. A lot of my code seems not to work when compiled with a
  23. : compiler ( gcc.2.7.x ) that implements this.
  24.  
  25. Sure.
  26.  
  27. 6.5.3 The for statement
  28. ...
  29.  4 If the for-init-statement is a declaration, the scope of the name(s)
  30.    declared extends to the end of the for-statement. [Example: 
  31.     int i = 42;
  32.     int a[10];
  33.  
  34.     for (int i = 0; i < 10; i++) 
  35.         a[i] = i;
  36.  
  37.      int j = i; // j = 42
  38.    -end example]
  39. ...
  40.  
  41. Regards
  42.  
  43.    -A.
  44. -- 
  45. | A.Champion                |
  46. ---
  47. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  48.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  49.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  50.